﻿<%@ Page Language="C#" MasterPageFile="~/Front.Master" AutoEventWireup="true" CodeBehind="EditUserInfo.aspx.cs" Inherits="HRProject.User.EditUserInfo" Title="Untitled Page" %>
<asp:Content ID="IncludePlaceHolder" ContentPlaceHolderID="IncludePlaceHolder" runat="server">
    <link href="/css/jsDatePick_ltr.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" language="javascript" src="/js/jsDatePick.min.1.3.js"></script>
    <script type="text/javascript" language="javascript" src="/js/userinfo.js"></script>
    <script type="text/javascript">
    function init()
    {
        url = window.location.href;
		new JsDatePick({
			useMode:2,
			target:"<%= tbxBirthDate.ClientID %>",
			dateFormat:"%d/%m/%Y"
		});
	};
    </script>
</asp:Content>
<asp:Content ID="TitleIconPlaceHolder" ContentPlaceHolderID="TitleIconPlaceHolder" runat="server">
    <img alt="" src="/image/layout/icon/UserIcon.png" />
</asp:Content>
<asp:Content ID="TitleNamePlaceHolder" ContentPlaceHolderID="TitleNamePlaceHolder" runat="server">
    Edit Agent information
</asp:Content>
<asp:Content ID="MainPanelPlaceHolder" ContentPlaceHolderID="MainPanelPlaceHolder" runat="server">
    <table>
        <tr>
            <td><asp:Image ID="imgIcon" runat="server" Width="100" Height="100"/></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblUserName" runat="server" Text="Username"></asp:Label></td>
            <td>
                <asp:Label ID="lblUserNameInfo" runat="server"></asp:Label>
                <asp:CheckBox ID="ckbActivate" runat="server" Text="Kích hoạt"/>
                <asp:HyperLink ID="hplChangePassword" runat="server" NavigateUrl="/User/ChangePassword.aspx" Text="ChangePassword"></asp:HyperLink>
                <asp:HyperLink ID="hplViewStatistics" runat="server" NavigateUrl="/User/TaskStatistics.aspx" Text="View statistics"></asp:HyperLink>
            </td>
        </tr>
        <tr>
            <td><asp:CheckBox ID="cbxIcon" runat="server" Text="Image"/></td>
            <td>
                <asp:FileUpload ID="fulIcon" runat="server"/>
            </td>
        </tr>
        <tr>
            <td><asp:Label ID="lblName" runat="server" Text="Full name"></asp:Label></td>
            <td><asp:TextBox ID="tbxFullName" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblIdentifierSerial" runat="server" Text="Identifier serial"></asp:Label></td>
            <td><asp:TextBox ID="tbxIdentifierSerial" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblBirthDate" runat="server" Text="Birthdate"></asp:Label></td>
            <td>
                <asp:TextBox ID="tbxBirthDate" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td><asp:Label ID="lblBirthPlace" runat="server" Text="Birthplace"></asp:Label></td>
            <td><asp:TextBox ID="tbxBirthPlace" runat="server"></asp:TextBox></td>
        </tr>
        
        <tr>
            <td><asp:Label ID="lblGender" runat="server" Text="Gender"></asp:Label></td>
            <td>
                <asp:DropDownList ID="ddlGender" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td><asp:Label ID="lblPhone" runat="server" Text="Phone"></asp:Label></td>
            <td><asp:TextBox ID="tbxPhone" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblContact" runat="server" Text="Contact"></asp:Label></td>
            <td><asp:TextBox ID="tbxContact" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblEmail" runat="server" Text="Email"></asp:Label></td>
            <td><asp:TextBox ID="tbxEmail" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblPeople" runat="server" Text="People"></asp:Label></td>
            <td><asp:TextBox ID="tbxPeople" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblMaritalStatus" runat="server" Text="Marital status"></asp:Label></td>
            <td><asp:TextBox ID="tbxMaritalStatus" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblAddress" runat="server" Text="Address"></asp:Label></td>
            <td><asp:TextBox ID="tbxAddress" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td><asp:Label ID="lblAddress2" runat="server" Text="Address 2"></asp:Label></td>
            <td><asp:TextBox ID="tbxAddress2" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td valign="top">
                <asp:Label ID="lblAssets" runat="server" Text="Assets"></asp:Label>
                <input type="button" value="+" onclick="selectAssets();"/>
            </td>
            <td>
                <table id="tblAssets">
                    <tr>
                        <th>Asset name</th>
                        <th>Assigned time</th>
                        <th>Returned time</th>
                        <th>Description</th>
                        <th></th>
                    </tr>
                    <%
                        for (int i = 0; i < Assets.Count; i++)
                        {
                    %>
                    <tr>
                        <td>
                            <input type="text" name="tbxAssetName" value="<%= Assets[i].Asset.Name %>" disabled="disabled" style="width:200px"/>
                            <input type="hidden" name="hdfAssetId" value="<%= Assets[i].Asset.Id %>"/>
                        </td>
                        <td>
                            <input type="text" name="tbxAssetStartDate" value="<%= Assets[i].StartDate.ToString("dd/MM/yyyy") %>" style="width:120px"/>
                        </td>
                        <td>
                            <input type="text" name="tbxAssetEndDate" value="<%= Assets[i].EndDate.ToString("dd/MM/yyyy") %>" style="width:120px"/>
                        </td>
                        <td>
                            <input type="text" name="tbxAssetDescription" value="<%= Assets[i].Description %>" style="width:220px"/>
                        </td>
                        <td>
                            <input type="button" value="X" onclick="removeAsset(this);"/>
                        </td>
                    </tr>
                    <% } %>
                    <tr id="sampleAsset" style="display:none;">
                        <td>
                            <input type="text" name="tbxAssetName" disabled="disabled" style="width:200px"/>
                            <input type="hidden" name="hdfAssetId" disabled="disabled" />
                        </td>
                        <td>
                            <input type="text" name="tbxAssetStartDate" disabled="disabled" style="width:120px"/>
                        </td>
                        <td>
                            <input type="text" name="tbxAssetEndDate" disabled="disabled" style="width:120px"/>
                        </td>
                        <td>
                            <input type="text" name="tbxAssetDescription" disabled="disabled" style="width:220px"/>
                        </td>
                        <td>
                            <input type="button" value="X" onclick="removeAsset(this);"/>
                        </td>
                    </tr>
                </table>
                <div style="display:none" id="divRemovedAssets">
                    <input type="hidden" name="hdfRemovedAssetId" id="sampleRemovedAssetId" disabled="disabled"/>
                </div>
            </td>
        </tr>
        <tr>
            <td valign="top"><asp:Label ID="lblExtraDescription" runat="server" Text="Extra information"></asp:Label></td>
            <td>
                <asp:TextBox ID="txaExtraDescription" runat="server" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <asp:Label ID="lblRecords" runat="server" Text="Records"></asp:Label>
                <input id="btnAddRecord" type="button" value="+" onclick="addRecord();"/>
            </td>
            <td>
                <table id="tblRecords">
                    <tr style="display:table-row">
                        <th></th>
                        <th>Value</th>
                        <th>Start time</th>
                        <th>End time</th>
                        <th>Rating</th>
                        <th></th>
                    </tr>
                    <%
                    for (int i = 0; i < Records.Count; i++)
                    {
                        %>
                        <tr>
                            <td>
                                <select name="ddlRecord">
                                <%
                                for (int j = 0; j < RecordTypes.Count; j++)
                                {
                                    %>
                                    <option value="<%= RecordTypes[j].Id %>" <%= RecordTypes[j].Id.Equals(Records[i].Type.Id) ? "selected" : "" %> >
                                    <%= RecordTypes[j].Name %></option>
                                    <%
                                }
                                %>
                                </select>
                                <input type="hidden" name="hdfRecordId" value="<%= Records[i].Id %>" />
                            </td>
                            <td><input type="text" name="tbxRecordValue" value="<%= Records[i].Description %>" style="width:250px"/></td>
                            <td>
                                <input type="text" id="<%= TbxRecordStartDates[i] %>" name="tbxRecordStartTime" value="<%= Records[i].StartDate.ToString("dd/MM/yyyy") %>" style="width:100px"/>
                                <script type="text/javascript">
                                new JsDatePick({
			                        useMode:2,
			                        target:"<%= TbxRecordStartDates[i] %>",
			                        dateFormat:"%d/%m/%Y"
		                        });
                                </script>
                            </td>
                            <td>
                                <input type="text" id="<%= TbxRecordEndDates[i] %>" name="tbxRecordEndTime" value="<%= Records[i].EndDate.ToString("dd/MM/yyyy") %>" style="width:100px"/>
                                <script type="text/javascript">
                                new JsDatePick({
			                        useMode:2,
			                        target:"<%= TbxRecordEndDates[i] %>",
			                        dateFormat:"%d/%m/%Y"
		                        });
                                </script>
                            </td>
                            <td><input type="text" name="tbxRecordRating" value="<%= Records[i].Rating %>" style="width:30px"/></td>
                            <td><input id="Button1" type="button" value="X" onclick="removeRecord(this);"/></td>
                            <td></td>
                        </tr>
                        <%
                    }
                    %>
                    <tr id="sampleRow" style="display:none">
                        <td>
                            <select name="ddlRecord" disabled="disabled">
                                <%
                                for (int j = 0; j < RecordTypes.Count; j++)
                                {
                                    %>
                                    <option value="<%= RecordTypes[j].Id %>">
                                    <%= RecordTypes[j].Name %></option>
                                    <%
                                }
                                %>
                            </select>
                            <input type="hidden" name="hdfRecordId" value="" disabled="disabled"/>
                        </td>
                        <td><input type="text" name="tbxRecordValue" disabled="disabled" style="width:250px"/></td>
                        <td><input type="text" name="tbxRecordStartTime" disabled="disabled" style="width:100px"/></td>
                        <td><input type="text" name="tbxRecordEndTime" disabled="disabled" style="width:100px"/></td>
                        <td><input type="text" name="tbxRecordRating" disabled="disabled" style="width:30px"/></td>
                        <td><input id="btnRemoveRecord" type="button" value="X" onclick="removeRecord(this);"/></td>
                    </tr>
                </table>
                <div id="divRemovedRecords" style="display:none">
                    <input type="hidden" name="hdfRemovedRecordId" id="sampleRemovedRecordId" disabled="disabled"/>
                </div>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:Button ID="btnOK" runat="server" Text="Update" onclick="btnOK_Click" 
                    style="height: 26px"/>
                <input type="button" name="btnCancel" value="Cancel"
                    onclick="document.body.style.display='none';" visible="false"/>
            </td>
        </tr>
        <tr>
            <td></td>
            <td><asp:Label ID="lblError" runat="server" Text="" ForeColor="Red" EnableViewState="false"></asp:Label></td>
        </tr>
    </table>
</asp:Content>
